﻿using HighThroughput.ShareData;
using OSSUtility;
using Ozone.Help;
using Ozone.ShareData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Ozone.Views.ServiceCenter
{
    /// <summary>
    /// UCAppLog.xaml 的交互逻辑
    /// </summary>
    public partial class UCAppLog : UserControl
    {
        public UCAppLog()
        {
            InitializeComponent();
            RefreshUIThread();
        }

        private void RefreshUIThread()
        {
         

            Task.Run(() =>
            {
                while (true)
                {

                 
                    try
                    {
                        this.Dispatcher.Invoke(new Action(
                            delegate
                            {
                                try
                                {
                                    lock (AppLogData.Entity.objAppLogLock)
                                    {
                                        dgAppLog.ItemsSource = null;
                                        dgAppLog.ItemsSource = AppLogData.Entity.lstApplog;
                                    }
                                }
                                catch (Exception ex)
                                {

                                }
                            }
                            )
                        );
                    }
                    catch (Exception ex)
                    {
                    }

                    Thread.Sleep(1000);
                }
            });
        }
    }
}
